import request from '@/api/request.js'
import requestBlob from '@/api/requestBlob'
const api_name = 'AuthorityURL'

const api_menu = 'MenuURL'

export default {
  //查询一个人的菜单管理权限(只包含有的)
  selectRoleAuthority(roleId) {
    return request({
      url: `${api_name}/selectRoleAuthority/${roleId}`,
      method: 'get',
    })
  },
  //查询一个人的菜单按钮权限
  selectRoleAuthorityButton(Data) {
    return request({
      url: `${api_name}/selectRoleAuthorityButton`,
      method: 'post',
      data: Data,
    })
  },
  //查询一个人的权限包括有和没有
  selectRoleAuthorityAll(roleId) {
    return request({
      url: `${api_name}/selectRoleAuthorityAll/${roleId}`,
      method: 'get',
    })
  },
  //删除一个人的菜单管理权限
  deleteAutority(Data) {
    return request({
      url: `${api_name}/deleteAutority`,
      method: 'post',
      data: Data,
    })
  },
  //新增一个人的菜单管理权限 
  insertAuthority(Data) {
    return request({
      url: `${api_name}/insert`,
      method: 'post',
      data: Data,
    })
  },

  //查询所有菜单
  selectList(Data) {
    return request({
      url: `${api_menu}/selectList`,
      method: 'post',
      data: Data,
    })
  },
  //根据id查询菜单
  selectByMenuId(menuId) {
    return request({
      url: `${api_menu}/selectByMenuId/${menuId}`,
      method: 'get',
    })
  },
  //修改菜单
  updateByMenuId(Data) {
    return request({
      url: `${api_menu}/updateByMenuId`,
      method: 'post',
      data: Data,
    })
  },
  //删除菜单
  deleteByMenuId(menuId) {
    return request({
      url: `${api_menu}/deleteByMenuId/${menuId}`,
      method: 'get',
    })
  },
  //添加菜单
  insert(Data) {
    return request({
      url: `${api_menu}/insert`,
      method: 'post',
      data: Data,
    })
  },
  //导出Excel
  exportMenu() {
    return requestBlob({
      url: `${api_menu}/exportMenu`,
      method: 'get',
    })
  },
}